#include<bits/stdc++.h>
#define ll long long
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
const double eps = 1e-9;
//#define int long long
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
ll fastpower(ll x,ll n){ll res=1;while(n){if(n&1)res=res*x;x=x*x;n=n/2;}return res;}
double roundd(double a){
if(fabs((a * 100.0) - (int)(a * 100) - 0.5) > eps && (int)(a * 1000) % 10 >= 5)
return ceil(a * 100.0) / 100.0;
else
return floor(a * 100.0) / 100.0;;
}
bool isprime(int n)
{
if(n==2)return true;
if(n<2||n%2==0)return false;
for (long long i = 3; i*i<=n; i+=2) {
if (n % i == 0)
return false;
}
return true;
}
int qqx[]={0,0,-1,1,1,-1,1,-1};
int qqy[]={1,-1,0,0,1,1,-1,-1};
bool valid(int i,int j,int n,int m)
{
if(i>=0&&j>=0&&i<n&&j<m)return true;
return false;
}
ll gcd(ll a,ll b)
{
if(b==0)return a;
return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
return a/gcd(a,b)*b;
}
int inf=1e9+7;
#define F first
#define S second
#define int ll
int MOD =1e9+7;
bool compare(const pair<int, int>& a, const pair<int, int>& b) {
return a.first > b.first;
}
bool check(int pos,int row)
{
if(pos>=1&&pos<=row)
return true;
return false;
}
const int siz = 2e5 + 10;
int n,k;
int f[siz];
bool can(int m,vector<int>&b)
{
int cnt=k;
for(int i=0;i<siz; i++)
{
int temp = f[i];
while(temp>=m){
b.push_back(i);
temp-=m;
cnt--;
if(cnt==0){
return true;
}
}
}
return false;
}
void out()
{
cin>>n>>k;
vector<int>a(n);
for(int i=0;i<n;i++)cin>>a[i];
for(auto &i:a)f[i]++;
int l=1,r=1e6;
int ans = 1;
vector<int>res;
vector<int>b;
while(r>=l)
{
b.clear();
int m=l+(r-l)/2;
if(can(m,b))
{
res = b;
ans=m;
l=m+1;
}
else{
r=m-1;
}
}
//cout<<ans;
for(auto &i : res )cout<<i<<" ";
}
signed main()
{
//freopen("", "r", stdin);
cin.tie(0);
cin.sync_with_stdio(0);
int testCase=1;
//cin>>testCase;
while(testCase--)
{
out();
cout<<"\n";
}
return 0;
}
148A - Insomnia cure | 1650A - Deletions of Two Adjacent Letters |
1512A - Spy Detected | 282A - Bit++ |
69A - Young Physicist | 1651A - Playoff |
734A - Anton and Danik | 1300B - Assigning to Classes |
1647A - Madoka and Math Dad | 710A - King Moves |
1131A - Sea Battle | 118A - String Task |
236A - Boy or Girl | 271A - Beautiful Year |
520B - Two Buttons | 231A - Team |
479C - Exams | 1030A - In Search of an Easy Problem |
158A - Next Round | 71A - Way Too Long Words |
160A - Twins | 1A - Theatre Square |
1614B - Divan and a New Project | 791A - Bear and Big Brother |
1452A - Robot Program | 344A - Magnets |
96A - Football | 702B - Powers of Two |
1036A - Function Height | 443A - Anton and Letters |